<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!-- public quote -->
<%@include file="/jsp/comm_css_include.jsp"%>
<!doctype html>
<html>
<head>
<style type="text/css">
li {
	list-style: none;
}
</style>
</head>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="iboxtitle">
			<span><i class="glyphicon glyphicon-map-marker"></i>&nbsp;财务相关>客户代偿打款</span>
		</div>
		<div class="buttonfixed">
			<button id="btnsave" type="button" class="btn dpbtn_blue btnaplly" onclick="save();">保存提交</button>
		</div>
		<div class="ibox-content ibox-con" style="padding-top: 0; border-top: none;">
			<form class="form-horizontal" id="commentForm">
				<%@include file="/jsp/comm_yw_info_include.jsp"%>
				<%@include file="/jsp/comm_yw_daidian_include.jsp"%>
				<div class="business-manwife">代偿附件</div>
				<div class="business-padding">
					<div class="zx-addimg">
					<ul id="ZHONG_YAO_YUAN_JIAN">
						<li><img
							filelabel="${attachmentLabelNames.DAI_CHANG_FU_JIAN1 }"
							src="${basePath}/img/shangchuanzhaopian.png" width="110px"
							height="110px"
							class="zx-imgPre ${attachmentLabelNames.DAI_CHANG_FU_JIAN1 }">
							<span
							filelabelDelSpan="${attachmentLabelNames.DAI_CHANG_FU_JIAN1 }"
							class="hidden bt-cancle glyphicon glyphicon-trash"
							onclick="deleleFileRecord(this,'${attachmentLabelNameValues.DAI_CHANG_FU_JIAN1 }',false);"></span>
							<div class="img-layer">
								<div></div>
								<span
									filelabelLabelSpan="${attachmentLabelNames.DAI_CHANG_FU_JIAN1 }">${attachmentLabelNameValues.DAI_CHANG_FU_JIAN1 }</span>
							</div>
							<div filelabelDiv="${attachmentLabelNames.DAI_CHANG_FU_JIAN1 }"
								class="hidden button-des">
								<a type="button"
								class="abuttonStylele"  filelabelADown="${attachmentLabelNames.DAI_CHANG_FU_JIAN1 }"
									download="shangchuanzhaopian.png"
									href="${basePath}/img/shangchuanzhaopian.png">下载</a> <a
									type="button" class="abuttonStyleri"  onclick="showImg(this);">详情</a>
							</div> <a href="javascript:void(0);" class="file"> <span>上传资料</span>
								<input type="file"
								accept="image/gif,image/jpeg,image/bmp,image/png,image/jpg"
								onchange="uploadFile(this,'${modeIDTypeNames.CWDK }','ZHONG_YAO_YUAN_JIAN', false, false);" />
						</a></li>
						<li><img
							filelabel="${attachmentLabelNames.DAI_CHANG_FU_JIAN2 }"
							src="${basePath}/img/shangchuanzhaopian.png" width="110px"
							height="110px"
							class="zx-imgPre ${attachmentLabelNames.DAI_CHANG_FU_JIAN2 }">
							<span
							filelabelDelSpan="${attachmentLabelNames.DAI_CHANG_FU_JIAN2 }"
							class="hidden bt-cancle glyphicon glyphicon-trash"
							onclick="deleleFileRecord(this,'${attachmentLabelNameValues.DAI_CHANG_FU_JIAN2 }',false);"></span>
							<div class="img-layer">
								<div></div>
								<span
									filelabelLabelSpan="${attachmentLabelNames.DAI_CHANG_FU_JIAN2 }">${attachmentLabelNameValues.DAI_CHANG_FU_JIAN2 }</span>
							</div>
							<div filelabelDiv="${attachmentLabelNames.DAI_CHANG_FU_JIAN2 }"
								class="hidden button-des">
								<a type="button"
								class="abuttonStylele"  filelabelADown="${attachmentLabelNames.DAI_CHANG_FU_JIAN1 }"
									download="shangchuanzhaopian.png"
									href="${basePath}/img/shangchuanzhaopian.png">下载</a> <a
									type="button" class="abuttonStyleri"  onclick="showImg(this);">详情</a>
							</div> <a href="javascript:void(0);" class="file"> <span>上传资料</span>
								<input type="file"
								accept="image/gif,image/jpeg,image/bmp,image/png,image/jpg"
								onchange="uploadFile(this,'${modeIDTypeNames.CWDK }','ZHONG_YAO_YUAN_JIAN', false, false);" />
						</a></li>
					</ul>	
				</div>	
	            </div>
				<div class="business-manwife">收款信息</div>
				<div class="padding-nono">
					<table cellpadding="0" cellspacing="0" border="0"
						class="buyinfor-table">
						<tr>
							<td align="right"><label class="control-label np">垫款账号：</label>
							</td>
							<td><input class="form-control" type="text"
								id="cardnoInstead" name="cardnoInstead" /></td>
							<td align="right"><label class="control-label np">代偿金额：</label>
							</td>
							<td><input id="amountInstead" name="amountInstead"
								required="required" placeholder="代偿金额(必填)" class="form-control"
								type="text" /></td>
						</tr>
					</table>
				</div>
				<div class="business-manwife">打款信息</div>
				<div class="padding-nono">
					<table cellpadding="0" cellspacing="0" border="0"
						class="buyinfor-table">
						<tr>
							<td align="right"><label class="control-label np">打款账号：</label>
							</td>
							<td><input class="form-control" required="required"
								type="text" id="cardnoRemit" name="cardnoRemit"
								placeholder="打款账号(必填)" /></td>
						</tr>
						<tr>
							<td align="right"><label class="control-label np">到账时间：</label>
							</td>
							<td><input id="dateToAccount" name="dateToAccount"
								placeholder="到账时间" class="laydate-icon form-control"
								onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" />
							</td>
						</tr>
						<tr>
							<td align="right"><label class="control-label np">财务审核人：</label>
							</td>
							<td><input class="form-control" type="text" id="auditor"
								name="auditor" /></td>

							<td align="right"><label class="control-label np">财务审核时间：</label>
							</td>
							<td><input id="timeAudit" name="timeAudit"
								placeholder="财务审核时间" class="laydate-icon form-control"
								onclick="laydate()" /></td>
						</tr>
					</table>
				</div>
				<div class="business-manwife">经办信息</div>
				<div class="padding-nono">
					<table cellpadding="0" cellspacing="0" border="0"
						class="buyinfor-table">
						<tr>
							<td align="right"><label class="control-label np">经办人：</label>
							</td>
							<td><input class="form-control" type="text" id="operator"
								name="operator" readonly="readonly"
								value="${current_user_key.uname}" /></td>
							<td align="right"><label class="control-label np">经办时间：</label>
							</td>
							<td><input id="operaterTime" name="operaterTime"
								placeholder="经办时间" class="laydate-icon form-control"
								onclick="laydate()" /></td>
						</tr>
					</table>
				</div>
			</form>
		</div>
	</div>
	<input type="hidden" id="loanBank">
	</div>

	<!-- public quote -->
	<%@include file="/jsp/comm_js_include.jsp"%>
	<!-- summernote -->
	<%@include
		file="/js/common-dpqc/dpqc-summernote/comm_summernote_include.jsp"%>

	<%@include file="/jsp/common_fileupload_include.jsp"%>

	<!-- layerDate plugin javascript -->
	<script type="text/javascript"
		src="${basePath}/js/plugins/layer/laydate/laydate.js"></script>

	<!-- custom js -->
	<%@include
		file="/js/common-dpqc/dpqc-validate/comm_validate_include.jsp"%>
	<script type="text/javascript"></script>
	<!--
    	作者：zhangpp
    	时间：2017-04-06
    	描述：js
    -->
	<script type="text/javascript">
	    $(function(){
			getInfo();
	        $("#commentForm").validate({
	            rules: {
	            	amountInstead:{
	            		 allMoney: true,
	            	},
	            },
	            //重写showErrors
	            showErrors: function (errorMap, errorList) {
	                
	                $.each(errorList, function (i, v) {
	                    layer.tips(v.message, v.element, { time: 1500 });
	                    return false;
	                });  
	            },
	            /* 失去焦点时验证 */
	            onfocusout: function(element) { $(element).valid(); },
	            /*  键盘抬起不验证 */
	            onkeyup:false,
	        });
		});
	    
	    var save=function(){
	    	var validstatus = $("#commentForm").valid();
			if(!validstatus){
				layer.msg('有验证未通过，请仔细检查！', {icon: 5});
				return;
			}
	    	var data={};
	    	data.cardnoInstead=$("#cardnoInstead").val();
	    	data.amountInstead=$("#amountInstead").val();
	    	data.cardnoRemit=$("#cardnoRemit").val();
	    	data.dateToAccount=$("#dateToAccount").val();
	    	data.auditor=$("#auditor").val();
	    	data.timeAudit=$("#timeAudit").val();
	    	data.jbTime=$("#operaterTime").val();
	    	data.dateInstead=$("#operaterTime").val();
// 	    	data.modifierName=$("#operator").val();
//         	data.modifier="${current_user_key.id}";
			data.busiId=$.getUrlData("busiId");
			data.cusId=$.getUrlData("cusId");
			data.loanBank=$.getUrlData("loanBank");
			data.cusName=$.getUrlData("cusName");
        	data.insteadId=$.getUrlData("applyId");
        	data.batchInsteadId=$.getUrlData("batchId");
        	data.statusInstead=30;
	    	$.dpAjax({
	    		url:'${basePath}/DhInsteadPaymentApplyController/save',
	    		data:data,
				success: function(datas){
					  layer.msg('执行成功！', {icon: 6});
					  window.location.href="${basePath}/web/system/cw/kehuHaveMoneyList.jsp";
					  return;
	            }
	    	});
	    }
	    
		var getInfo=function(){
			var data={};
			data.busiId=$.getUrlData("busiId");
			data.orderSql="created desc";
			$.dpAjax({
	    		url:'${basePath}/DhInsteadPaymentApplyController/list',
	    		data:data,
				success: function(datas){
					 var data=datas.result.rows;
   				  	 if(data.length>0){
   					    $("#cardnoInstead").val(data[0].cardnoInstead);
   				    	$("#amountInstead").val(data[0].amountInstead);
   				    	$("#cardnoRemit").val(data[0].cardnoRemit);
   				    	$("#dateToAccount").val(data[0].dateToAccount);
   				    	$("#auditor").val(data[0].auditor);
   				    	$("#timeAudit").val(data[0].timeAudit);
   				    	$("#operaterTime").val(data[0].dateInstead);
   				    	showAttentment($.getUrlData('busiId'), null, '${modeIDTypeNames.CWDK }');
   				  	}
	            }
	    	});
	    }
		
		var update=function(){
			var data={};
	    	data.cardnoInstead=$("#cardnoInstead").val();
	    	data.amountInstead=$("#amountInstead").val();
	    	data.cardnoRemit=$("#cardnoRemit").val();
	    	data.dateToAccount=$("#dateToAccount").val();
	    	data.auditor=$("#auditor").val();
	    	data.timeAudit=$("#timeAudit").val();
	    	data.dateInstead=$("#operaterTime").val();
        	data.id=$.getUrlData("applyId");
        	data.statusInstead=30;
	    	$.dpAjax({
	    		url:'${basePath}/DhInsteadPaymentApplyController/modify',
	    		data:data,
				success: function(datas){
					layer.msg('执行成功！', {icon: 6});
					return;
	            }
	    	});
		}
    </script>
</body>
</html>
